package cz.cuni.amis.episodic.bayes.utils.chart;

import java.io.File;
import java.text.DecimalFormat;

import lombok.Getter;
import lombok.Setter;

import org.jfree.chart.JFreeChart;

/**
 *
 * @author ik
 */
public class GraphPaintingDevice {
	int width = 400;
	int height = 500;
	
	DecimalFormat decimalFormat = new DecimalFormat("00");
    
    /**
     * Directory where the graphs will be stored.
     */
    @Setter
    @Getter
    File rootDirectory = null;

    public GraphPaintingDevice(File rootDirectory) {
		this.rootDirectory = rootDirectory;
		rootDirectory.mkdirs();
	}
    
	public GraphPaintingDevice(File rootDirectory, int width, int height) {
		this(rootDirectory);
		this.width = width;
		this.height = height;
	}
    
    public void outputGraph(JFreeChart graph, File dir, String name)  throws Exception {
    	throw new UnsupportedOperationException();
    }

    public void outputGraph(JFreeChart graph, String name)  throws Exception {
        outputGraph(graph, rootDirectory, name);
    }
    
    public void outputGraph(JFreeChart graph, String name, int sequenceNum) throws Exception {
        String sequenceStr = decimalFormat.format(sequenceNum);
        outputGraph(graph, name + "_" + sequenceStr);
    }
    
    
    public void networkKLGraph(double[][] kl, String[] nodes, String title) {
        
    }
}
